#pragma once

#include "stdafx.h"

class CETHFram
{
public:
	CETHFram(const unsigned char*data, unsigned int plen);
	~CETHFram();

	static bool Initialize();

	INT32 Process();
	UINT32 GetHashVal(UINT32 width);
	uchar* GetTCPPayload() { return &mData[mHdrlen]; }
	UINT32 GetTCPPayloadLen() { return mTCPPayloadlen; }
	ULONG GetPktSeq() { return ntohl(mTcpHdr->th_seq); }

private:
	unsigned int mDatalen;
	bool mPreProcessFlag;

	uchar*mData;
	int mHdrlen;
	int mPackettotallen;
	UINT32 mTCPPayloadlen;
	const ethhdr_t	*mEthHdr;
	const iphdr_t	*mIpHdr;
	const tcphdr_t	*mTcpHdr;
	unsigned char*mUdpHdr;
	unsigned char mIPProtocol;

	static std::vector<IN_ADDR> gLocalAdds;

	bool VerifyIPAddr();
	bool PreProcess();
};

